package fhq.hcmute.edu.vn.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import fhq.hcmute.edu.vn.util.ProjectUtil;

public class SearchSpecificFileActivity extends Activity {
	private TextView txtSpecificType;
	private Button btnOK;
	private Button btnCancel;
	public static final String SPECIFIC_TYPE = "SPECIFIC_TYPE";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_search_specific_file);
		init();
	}

	private void init() {
		txtSpecificType = (TextView) findViewById(R.id.txtSpecificType);
		btnOK = (Button) findViewById(R.id.btnOK);
		btnOK.setOnClickListener(onOKClick);
		btnCancel = (Button) findViewById(R.id.btnCancel);
		btnCancel.setOnClickListener(onCancel);
	}

	private OnClickListener onOKClick = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			Intent data = getIntent();
			data.putExtra(SPECIFIC_TYPE, txtSpecificType.getText().toString());
			setResult(ProjectUtil.RESULT_CODE_SPECIFIC_TYPE, data);
			finish();
		}
	};
	private OnClickListener onCancel = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			finish();
		}
	};
}
